Skip to content

ci: harden CI/security pipelines, add smoke workflow and reference implementations#4

Merged
Shards-inc merged 1 commit intomainfrom
codex/enhance-ci-with-multi-version-testing-and-security
Mar 7, 2026
Merged

ci: harden CI/security pipelines, add smoke workflow and reference implementations#4
Shards-inc merged 1 commit intomainfrom
codex/enhance-ci-with-multi-version-testing-and-security

Conversation

@Shards-inc
Copy link
Member

Motivation

  • Strengthen CI quality gates by running a Python 3.9–3.12 matrix with linting, format checks, type checks, security scans, coverage-enforced tests, smoke verification, and package build validation.
  • Improve security posture by scheduling CodeQL and adding dependency/vulnerability/secret scanning pipelines.
  • Provide small production-oriented reference implementations (thread-safe nonce registry and SQLite audit storage) to exercise CI, observability, and integration testing.

Description

  • Expanded .github/workflows/ci.yml to a multi-version Python matrix (3.9–3.12) and added steps for ruff lint/format checks, mypy over kernels and implementations, bandit security scan, coverage-enforced pytest, smoke script execution, and package build verification via python -m build.
  • Added .github/workflows/security.yml enhancements for scheduled CodeQL, dependency review, vulnerability scans (safety, pip-audit), and a gitleaks secret-scanning job, and adjusted .github/workflows/release.yml to include workflow_dispatch and twine check verification.
  • Added a new smoke workflow .github/workflows/smoke.yml for on-demand/manual/PR smoke runs that executes ./scripts/smoke.sh.
  • Introduced reference implementations: implementations/permits_threadsafe.py (TTL-aware, thread-safe nonce registry with stats()) and implementations/storage.py (SQLite-backed audit storage with append(), list_entries(), and health()).
  • Added targeted tests at tests/test_reference_implementations.py to validate concurrency, max-execution enforcement, TTL cleanup, SQLite persistence, and health diagnostics, and extended scripts/smoke.sh to exercise these implementations and set PYTHONPATH for local runs.
  • Developer experience updates: updated Makefile with new targets (format-check, dep-scan, smoke, build), lowered requires-python to >=3.9 in pyproject.toml, and added changelog entries describing the changes.

Testing

  • Ran ruff check implementations/permits_threadsafe.py implementations/storage.py tests/test_reference_implementations.py and the checks passed for the modified files.
  • Applied ruff format and then verified with ruff format --check for the same files (formatting applied where needed and check passed).
  • Ran mypy implementations/permits_threadsafe.py implementations/storage.py --follow-imports=skip and it reported no issues for the new implementations.
  • Executed pytest tests/test_reference_implementations.py -q and all tests passed (4 passed).
  • Executed the smoke script ./scripts/smoke.sh locally and it completed successfully exercising examples, the nonce registry, and SQLite storage.
  • Note: attempts to install and run the full set of external scanners and build tools (bandit, safety, pip-audit, build, twine) in this execution environment were blocked by package/index/proxy restrictions, so full repo-wide CI gates (lint across the whole repo, full mypy kernels, and coverage enforcement with pytest-cov) are configured in workflows but could not be fully validated here.

Codex Task

@Shards-inc Shards-inc merged commit 9ccac84 into main Mar 7, 2026
4 of 9 checks passed
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d8b474fc65

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

readme = "README.md"
license = {text = "MIT"}
requires-python = ">=3.11"
requires-python = ">=3.9"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep minimum Python version aligned with runtime syntax

Lowering requires-python to 3.9 advertises support that the codebase does not currently have: modules such as kernels/execution/dispatcher.py use PEP 604 unions (e.g. ToolCall | dict[str, Any]) without from __future__ import annotations, which raises TypeError during import on Python 3.9. This means users installing on 3.9 (now allowed by metadata) and the new 3.9 CI lane will fail at runtime/import time rather than getting a compatible build.

Useful? React with 👍 / 👎.

Comment on lines +63 to +64
storage = SQLiteAuditStorage(".tmp/smoke/audit.db")
storage.append("kernel-smoke", entry)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make smoke SQLite check repeatable across runs

The smoke script always writes to .tmp/smoke/audit.db and inserts the same primary key (kernel-smoke, ledger_seq=1), so a second run in the same workspace raises sqlite3.IntegrityError and aborts because set -e is enabled. This makes ./scripts/smoke.sh non-idempotent for local/dev reruns and any environment that reuses the workspace.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant